// 引入对应要匹配的路由页面级组件
import Category1 from './Category1'
import Home1 from './Home1';
import Detail1 from './Detail1'
import { Navigate } from 'react-router-dom';
import Cate1 from './Cate1';
import Cate2 from './Cate2';
import Cate3 from './Cate3';
import Notfind from './Notfind';
const routes = [
    {
        path: '/home1',
        element: <Home1 />
    },
    {
        path: '/category1',
        element: <Category1 />,
        children: [ // 二级路由规则
            {
                path: '', // 默认显示的二级路由组件
                element: <Cate1></Cate1>,
            },
            {
                path: 'cate1',   // 当加/ 需要拼接一级路由path或者直接写二级路由的地址,但是不需要加'/'
                element: <Cate1></Cate1>
            },
            {
                path: '/category1/cate2',   // 当加/ 需要拼接一级路由path或者直接写二级路由的地址,但是不需要加'/'
                element: <Cate2></Cate2>,
                children: [ // 三级路由规则
                    {
                        path: 'cate3',
                        element: <Cate3 />
                    }
                ]
            }
        ]
    },
    {
        path: '/detail1/:id?',
        element: <Detail1 />
    },
    {
        path: '/',
        element: <Navigate to='/home1' />
    },
    {
        path: '*',  // 404 组件
        element: <Notfind></Notfind>
    },

]

export default routes
